package br.com.dataphonebr.util;

import org.json.JSONObject;

import br.com.dataphonebr.R;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;

public class DataphoneAsyncTask extends AsyncTask<String, Void, JSONObject> {
	
	private ProgressDialog progress;
	private String message;
	private Context context;

	public DataphoneAsyncTask(Context context) {
		this.progress = new ProgressDialog(context);
		this.context = context;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}

    protected void onPreExecute() {
    	if (message == null || message.isEmpty())
    		message = context.getString(R.string.processing_label);
        progress.setMessage(message);
        progress.show();
    }

	@Override
	protected JSONObject doInBackground(String... params) {
		return null;
	}
	
	@Override
	protected void onPostExecute(JSONObject result) {
		if (progress.isShowing()) {
            progress.dismiss();
        }
	}
}
